import request from '@/utils/request'

export function add(data) {
  return request({
    url: 'api/jjzhWxPayOrders',
    method: 'post',
    data
  })
}

export function del(ids) {
  return request({
    url: 'api/jjzhWxPayOrders/',
    method: 'delete',
    data: ids
  })
}

export function edit(data) {
  return request({
    url: 'api/jjzhWxPayOrders',
    method: 'put',
    data
  })
}

// 退款方法，传递 orderNo
export function refund(orderNo) {
  return request({
    url: `api/wxpay/refund?orderNo=${orderNo}`,
    method: 'get'
  })
}

// 退款方法，传递 orderNo
export function query(orderNo) {
  return request({
    url: `api/wechat/queryByOutTradeNo?orderNo=${orderNo}`,
    method: 'get'
  })
}
export function queryRefund(orderNo) {
  return request({
    url: `api/wechat/queryRefund?orderNo=${orderNo}`,
    method: 'get'
  })
}

export function updateOrdersStatus(orderNo, status) {
  return request({
    url: `/api/jjzhWxPayOrders/updateOrdersStatus?orderNo=${orderNo}&status=${status}`,
    method: 'get'
  })
}

export default { add, edit, del, refund, query, queryRefund }
